package nettypro.netty.inboundhandlerandouthandler;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * @ClassName MyLongToByteEncoder
 * @Description TODO
 * @Author zeny
 * @Date 2020/3/26 0026 9:44
 */
public class MyLongToByteEncoder extends MessageToByteEncoder<Long> {
    @Override
    protected void encode(ChannelHandlerContext ctx, Long msg, ByteBuf out) throws Exception {
        System.out.println("MyLongToByteEncoder encode 被调用");
        System.out.println("MyLongToByteEncoder encode msg=" + msg);
        out.writeLong(msg);
    }
}
